Skip to content

Fix create_github_release crashing when no release notes are given - #759

Merged
AliSoftware merged 3 commits into
trunkfrom
fix/create-github-release-without-notes
Jul 28, 2026
Merged

Fix create_github_release crashing when no release notes are given#759
AliSoftware merged 3 commits into
trunkfrom
fix/create-github-release-without-notes

Conversation

@oguzkocer

Copy link
Copy Markdown
Contributor

The problem

create_github_release raises whenever release_notes_file_path is omitted:

create_github_release_action.rb:17:in `gsub!': [!] can't modify frozen String: "" (FrozenError)

release_notes_file_path is declared optional: true, so omitting it is a supported path — but the '' fallback it lands on is a frozen literal, because the file sets frozen_string_literal: true. The next line then calls gsub! on it (the rewrite that turns bracketed GitHub PR/issue URLs into shorthand) and blows up.

File.read returns an unfrozen string, which is why the branch that does read a notes file has never hit this — and why every existing caller in the wild works. The optional path has simply never been exercised.

What this PR does

  • Uses the non-mutating gsub and reassigns. The regex and its behaviour are unchanged.
  • Adds spec/create_github_release_spec.rb, which the action didn't have:
    • the no-notes path, covering the regression directly;
    • the URL-rewrite behaviour, pinning the one line this PR touches so gsub + reassignment is proven equivalent to gsub!.

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations.
  • Add Unit Tests (aka specs/*_spec.rb) if applicable.
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass.
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.

`release_notes_file_path` is optional, but its `''` fallback is a frozen
literal (the file sets `frozen_string_literal: true`), so the `gsub!` that
rewrites bracketed GitHub URLs raised `FrozenError`. Use the non-mutating
`gsub` instead.

Adds specs for the action, which had none.
@dangermattic

dangermattic commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ No reviewers have been set for this PR yet. Please request a review from @⁠wordpress-mobile/apps-infrastructure.

Generated by 🚫 Danger

@oguzkocer
oguzkocer marked this pull request as ready for review July 28, 2026 21:19
@oguzkocer
oguzkocer requested a review from a team as a code owner July 28, 2026 21:20
@oguzkocer
oguzkocer requested a review from a team July 28, 2026 21:21

@AliSoftware AliSoftware left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ :shipit:

@AliSoftware
AliSoftware merged commit 3ac393d into trunk Jul 28, 2026
9 checks passed
@AliSoftware
AliSoftware deleted the fix/create-github-release-without-notes branch July 28, 2026 21:22
@oguzkocer

Copy link
Copy Markdown
Contributor Author

@AliSoftware Thank you for the light speed PR review. 🙇‍♂️

@AliSoftware

Copy link
Copy Markdown
Contributor

You're welcome 🙂

Btw @oguzkocer no need to add apps-infrastructure as reviewer on those PRs: our CODEOWNERS already adds apps-infra-tooling as a reviewer, which is a subteam of apps-infrastructure (one focusing only on the ones of us who work on those kind of tools) 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants